<?php

namespace App\Http\Controllers;

use Laravel\Lumen\Routing\Controller as BaseController;
use Illuminate\Http\Request;
use App\Http\Service\ArticleService;

class ArticleController extends BaseController
{

    protected $request;
    protected $articleService;

    public function __construct(Request $request, ArticleService $articleService)
    {
        $this->request = $request;
        $this->articleService = $articleService;
    }

    public function getDetail()
    {

        $id = $this->request->input('id', 0);
        $article = $this->articleService->getDetail($id);

        return toJSON($article);
    }
}
